home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
351-375
/
disk_359
/
dice
/
dice.lzh
/
lib
/
stdlib
/
atoi.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-04-01
|
442b
|
38 lines
/*
* int ATOI(str)
*
* (c)Copyright 1990, Matthew Dillon, All Rights Reserved
*/
#include <stdlib.h>
long
atol(str)
const char *str;
{
return(atoi(str));
}
int
atoi(str)
const char *str;
{
short neg = 0;
long v = 0;
while (*str == ' ' || *str == '\t')
++str;
if (*str == '-') {
neg = 1;
++str;
}
while (*str >= '0' && *str <= '9')
v = v * 10 + *str++ - '0';
if (neg)
v = -v;
return(v);
}